// pages/personal/personal.js
import { getUserInfoApi } from '../../api/user';

const app = getApp();
 
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 用户信息
    personInfo: {
      nickname: '',
      headimgurl: ''
    },
    defaultImg: 'https://img02.hua.com/wxmp/hua/def_user_header.png',
  },
  onShow() {
    if (!app.globalData.token || this.data.personInfo.nickname) return;
    this.getUserInfo();
  },
  async getUserInfo() {
    const res = await getUserInfoApi();
    // console.log(res);
    this.setData({
      personInfo: {
        nickname: '华哥',
        headimgurl: './3.gif'
      }
    })
  },
})